<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('projects', function (Blueprint $table) {
            $table->id();
            $table->string('title')->index();
            $table->unsignedBigInteger('push_id')->default(0)->comment('发布人');
            $table->string('contract_number')->nullable()->default('/')->comment('合同编号');
            $table->string('contract')->nullable()->default('/')->comment('合同(文件地址)');
            $table->string('brief')->nullable()->default('/')->comment('介绍');
            $table->string('pay_type')->nullable()->default('/')->comment('付款方式');
            $table->string('tax_type')->nullable()->default('/')->comment('合同税型');
            $table->integer('tax_rate')->default(0)->comment('税率');
            $table->string('structure_type')->nullable()->default('/')->comment('结构类型');
            $table->unsignedBigInteger('work_period')->nullable()->comment('工期');
            $table->date('tender_date')->nullable()->comment('预计投标日期');
            $table->decimal('price',10,2)->nullable()->comment('金额');
            $table->string('area')->nullable()->comment('面积');
            $table->string('manager')->nullable()->default('/')->comment('项目经理');
            $table->decimal('budget',10,2)->nullable()->comment('预算');
            $table->date('start_date')->index()->comment('项目开始时间');
            $table->date('end_date')->index()->comment('项目结束时间');
            $table->date('start_actual_date')->nullable()->comment('实际开始时间');
            $table->date('end_actual_date')->nullable()->comment('实际结束时间');
            $table->string('address')->default('/')->comment('项目地址');
            $table->string('status')->index()->default('/')->comment('');
            $table->string('construct_unit')->nullable()->default('/')->comment('建设单位');
            $table->string('build_unit')->nullable()->default('/')->comment('施工单位');
            $table->string('supervise_unit')->nullable()->default('/')->comment('监理单位');
            $table->string('design_unit')->nullable()->default('/')->comment('设计单位');
            $table->string('consortium_unit')->nullable()->default('/')->comment('联合体单位');
            $table->string('operation_unit')->nullable()->default('/')->comment('运营单位');
            $table->string('notification_of_award')->nullable()->comment('中标通知书');
            $table->string('completion_acceptance')->nullable()->comment('竣工验收证明书');
            $table->string('commendation')->nullable()->comment('表扬信');
            $table->string('transfer')->nullable()->comment('移交单');
            $table->string('archive_management')->nullable()->comment('档案管回单');
            $table->string('fire_safety')->nullable()->comment('消防验收合格证书');
            $table->string('audit_report')->nullable()->comment('审计（结算）报告');
            $table->decimal('gradation_price',10,2)->nullable()->comment('增减金额');
            $table->decimal('examine_price',10,2)->nullable()->comment('审定金额');
            $table->decimal('account_price',10,2)->nullable()->comment('累计到账金额');
            $table->decimal('pay_price',10,2)->nullable()->comment('已经支付金额');
            $table->decimal('balance_price',10,2)->nullable()->comment('目前现金余额');
            $table->decimal('no_pay_price',10,2)->nullable()->comment('未支付金额');
            $table->string('others')->nullable()->comment('其它资料');
            $table->string('remarks')->nullable()->default('/')->comment('备注');
            $table->unsignedBigInteger('company_id')->index();
            $table->tinyInteger('type')->index()->default(1)->comment('1签订施工合同 2承包');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('projects');
    }
};
